const { md5, secretKey } = require('../utils/salt.js');
var rp = require('request-promise');
const { target } = require('../utils/options');

const get = async () => {
    var options = {
        method: 'GET',
        uri: `${target}/service/`,
        qs: {},
        json: true // Automatically stringifies the body to JSON
    };
    let data = await rp(options);
    return data;
};
const add = async (parameter) => {
    var options = {
        method: 'POST',
        uri: `${target}/service/`,
        body: parameter,
        json: true // Automatically stringifies the body to JSON
    };
    let data = await rp(options);
    return data;
};
const remove = async (_id) => {
    var options = {
        method: 'DELETE',
        uri: `${target}/service/` + _id,
        json: true // Automatically stringifies the body to JSON
    };
    let data = await rp(options);
    return data;
};
const update = async (_id, parameter) => {
    var options = {
        method: 'PATCH',
        uri: `${target}/service/` + _id,
        body: parameter,
        json: true // Automatically stringifies the body to JSON
    };
    let data = await rp(options);
    return data;
};
module.exports = { get, add, remove, update };
